/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.mdb;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.*;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
/**
 *
 * @author Yash
 */
@MessageDriven(mappedName = "jms/trefliq/MovieReportQueue", activationConfig = {
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
public class MovieFlag implements MessageListener{

    @Override
    public void onMessage(Message message) {
        //Notify admin that a client has requested to notify a movie as inappropriate.
        TextMessage textMessage = (TextMessage) message;
        try {
            //TextMessage txtMsg = (TextMessage)message;
            System.out.println("A new request for movie flag received: " + textMessage.getText());
        } catch (JMSException ex) {
            Logger.getLogger(AccountApprovedListener.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
